package com.sfexpress.mycatweb.service.topo;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.springframework.stereotype.Service;

import com.google.gson.Gson;
import com.sfexpress.mycatweb.entity.topo.TopoNode;

@Service
public class MockTopoService implements TopoService {

	@Override
	public TopoNode getClusterTopo() throws Exception {
		Gson gson = new Gson();
		InputStream in = MockTopoService.class.getResourceAsStream("topo.json");
		BufferedReader reader = new BufferedReader(new InputStreamReader(in));
		TopoNode topoRootData = gson.fromJson(reader, TopoNode.class);
		return topoRootData;
	}

}
